tree <- read.csv("trees.csv")
summary(tere)
summary(tree)
names(tree)
?random
?rnorm
rnorm(5,30,sqt(30))
sqrt(30)
stdev
?var
rnorm(5,30,sqrt(30))
a <- rnorm(100, 30, sqrt(30))
a
mean(a)
hist(a)
hist(a,breaks=100)
a <- rnorm(1000, 30, sqrt(30))
hist(a,breaks=100)
hist(a,breaks=10)
hist(a,breaks=10)a <- c(1:10)#
b <- c(10:1)
a <- c(1:10)#
b <- c(10:1)
a
b
a+b
a/b
a*b
hist(a*b)
hist(a*b, breaks=8)
hist(a*b, breaks=4)
hist(a*b)#
quartz(); hist(a*b, breaks 8)
hist(a*b)#
quartz(); hist(a*b, breaks=8)
a
a <- rnorm(1000, 30, sqrt(30))
densityplot(~x)
?densityplot
?densityplot
densityplot(~x)
densityplot(~a)
histogram(~a)
#R intro -- lesson #2#
require(lattice)
#
x <- rnorm(1000, 100, sqrt(100))
historgram(x)
histogram(x)
summary(x)
#
x <- rnorm(1000, 100, sqrt(10))
histogram(x)
sqrt(100)
summary(x)
densityplot(x)
sd(x)
sqrt(10)
fivenum(x)
mode(fivenum(x))
mode(summary(x))
x <- rnorm(1000, 100, sqrt(100))#
histogram(x)#
mean(x)#
median(x)#
quantile(x)#
min(x)#
max(x)#
var(x)#
sd(x)
summary(tree)
length(summary(x))
length(summary(tree))
length(tree)
dim(tree)
x
plot(x)
class(tree)
mode(tree)
attributes(tee)
attributes(tree)
sd(x)
2*sd(x)
2*sd(x)+100
100_2*sd(x)
100+2*sd(x)
100-2*sd(x)
abline(h=c(100+2*sd(x),100-2*sd(x),lty=2)
)
quartz(,8,4);plot(x)#
#
abline(h=c(100+2*sd(x),100-2*sd(x),lty=3))
?lty
?abline
?par
quartz(,8,4);plot(x)#
#
abline(h=c(100+2*sd(x),100-2*sd(x)),lty=3)
methods(x)
methods(list)
t(tree)
tree
as.matrix(tree)
histogram(x,breaks=100)
histogram(x,breaks=10)
plot(tree)
summary(tree)
names(tree)
ls.str(tree)
ls.str(pat=tree)
ls.str(pat="tree")
summary(tree)
histo(rnorm(1000))
hist(rnorm(1000))
hist(rnorm(10000))
hist(rnorm(10000))
pnorm(-2)
qnorm(-2)
qnorm(0.02275013)
rt(1000)
rt(1000,10)
hist(rt(1000,100))
boxplot(fivenum(tree[5]))
boxplot(fivenum(rnorm(1000)))
boxplot(fivenum(x))
hist(x)
hist(tree)
hist(tree[1:5])
hist(tree[4:5])
ls.str(tree)
ls.str(pat="tree")
hist(tree[6:8])
tree[6]
tree[6:8]
tree[c(6:8)]
hist(tree[c(6:8)])
plot(tree[6:8])
boxplot(fivenum(x))
ls.str(pat="tree")
is.numeric(tree[1:24])
is.numeric(tree$[1:24])
tree$[1]
tree[1]
tree[,1]
tree[1]
dim(tree)
is.numeric(tree[,1])
is.numeric(c(tree))
is.numeric(c(tree[1,]))
ls.str(pat="tree")
plot(tree[20:24])
plot(tree[5:10])
sum <- tapply(tree$STBM, tree$CHBR, fivenum)
boxplot(sum)
#use the factor "CHBR" to look at the data#
#how many values at each factor level?#
sum <- tapply(tree$STBM, tree$CHBR, length)#
#median of values at each factor level:#
sum <- tapply(tree$STBM, tree$CHBR, mean)#
#summary . . .#
sum <- tapply(tree$STBM, tree$CHBR, fivenum)#
quartz(,8,4); boxplot(sum)
#use the factor "CHBR" to look at the data#
#how many values at each factor level?#
sum <- tapply(tree$STBM, tree$CHBR, length)#
#median of values at each factor level:#
sum <- tapply(tree$STBM, tree$CHBR, mean)#
#summary . . .#
sum <- tapply(tree$STBM, tree$CHBR, fivenum)#
quartz(,8,4); boxplot(sum)
help(TDist)
histo(rbinom(50))
hist(rbinom(50))
x <- c(0:50)
x
y <- dbinom(x,50,0.2)
plot(x,y)
rbinom(1000,50,0.2)
hist(rbinom(1000,50,0.2))
hist(rbinom(1000,5,0.2))
hist(rbinom(1000,500,0.2))
hist(rbinom(1000,5,0.2))
hist(rbinom(1000,500,0.5))
hist(rbinom(1000,500,1))
hist(rbinom(1000,500,.9))
hist(rbinom(1000,500,.1))
pnorm(80,100,10)
pnorm(90,100,10)
pnorm(10,100,10)
stripchart(x)
stripchart(tree$CHBR)
stripchart(tree[4])
stripchart(tree[5])
stripchart(tree[7])
stripchart(tree[8])
stripchart(tree[8], method="stacked")
stripchart(tree[8], method="stack")
x
x <- rnorm(1000, 100, sqrt(100))
hist(x)
boxplot(x,horizontal=TRUE,add=TRUE)
boxplot(x,horizontal=TRUE,add=TRUE, AT=100)
hist(x)
boxplot(x,horizontal=TRUE,add=TRUE, AT=150, axes=FALSE)
boxplot(x,horizontal=TRUE, AT=150, axes=FALSE)
hist(x,add=TRUE)
hist(x)
hist(x,ylim=c(0,300))
boxplot(x,horizontal=TRUE, AT=150, axes=FALSE)
hist(x,ylim=c(0,300))
boxplot(x,horizontal=TRUE,add=TRUE, AT=150, axes=FALSE)
stripchart(x,horizontal=TRUE,add=TRUE, AT=150, axes=FALSE)
stripchart(x,add=TRUE, AT=150, axes=FALSE)
stripchart(x,add=TRUE, at=150)
hist(x,ylim=c(0,300))
boxplot(x,horizontal=TRUE,add=TRUE, at=150, axes=FALSE)
boxplot(x,horizontal=TRUE,add=TRUE, at=250, axes=FALSE)
quartz(); hist(x,ylim=c(0,250)); boxplot(x, horizontal=TRUE, add=TRUE, at=250)
?boxplot
sum <- tapply(tree$STBM, tree$CHBR, fivenum)#
quartz(,8,4); boxplot(sum)
sum <- tapply(tree$STBM, tree$CHBR, fivenum)#
quartz(,8,4); boxplot(sum, notch=TRUE)
#example from baso paper#
# create table for comparison of groups accross stimulants using ech visitID as unique -- note some duplicate patients at multiple time points#
#
# use only wash_status 'no' data#
baso_washless <- subset(baso, wash_status == "n")#
# exclude non-responders#
baso_washless <- subset(baso_washless, Responder==1)#
#
tmp <- data.frame(ID=baso_washless$visit_ID, group=baso_washless$STATUS, stim=c(array("E1", length(baso_washless$E1)), array("E2", length(baso_washless$E2)),array("E3", length(baso_washless$E3)), array("E4", length(baso_washless$E4)), array("E5", length(baso_washless$E5)), array("E6", length(baso_washless$E6))), CD63=c(baso_washless$E1, baso_washless$E2, baso_washless$E3, baso_washless$E4, baso_washless$E5, baso_washless$E6), HMCD63=c(baso_washless$HM_E1, baso_washless$HM_E2, baso_washless$HM_E3, baso_washless$HM_E4, baso_washless$HM_E5, baso_washless$HM_E6))#
#
# define factors#
groupf <- tmp$group#
stimf <- tmp$stim#
# summarize#
agg <- by(tmp$CD63, list(stimf, groupf), fivenum)#
#
# plot figure 1A#
quartz(,10,5)#
boxplot(agg, ylab="%CD63", cex.lab=1.4, names=array(c("E1", "E2", "E3", "E4", "E5", "E6"),24), outline=FALSE); abline(v=c(6.5, 12.5, 18.5), lty=3)#
mtext("Allergic", 3, line=1, at=3.5)#
mtext("Control", 3, line=1, at=9.5)#
mtext("HM tolerant", 3, line=1, at=15.5)#
mtext("Outgrown", 3, line=1, at=21.5)#
mtext("A", cex=4, at=-1)
baso <- read.csv("0208_data_sum.csv")
#example from baso paper#
# create table for comparison of groups accross stimulants using ech visitID as unique -- note some duplicate patients at multiple time points#
#
# use only wash_status 'no' data#
baso_washless <- subset(baso, wash_status == "n")#
# exclude non-responders#
baso_washless <- subset(baso_washless, Responder==1)#
#
tmp <- data.frame(ID=baso_washless$visit_ID, group=baso_washless$STATUS, stim=c(array("E1", length(baso_washless$E1)), array("E2", length(baso_washless$E2)),array("E3", length(baso_washless$E3)), array("E4", length(baso_washless$E4)), array("E5", length(baso_washless$E5)), array("E6", length(baso_washless$E6))), CD63=c(baso_washless$E1, baso_washless$E2, baso_washless$E3, baso_washless$E4, baso_washless$E5, baso_washless$E6), HMCD63=c(baso_washless$HM_E1, baso_washless$HM_E2, baso_washless$HM_E3, baso_washless$HM_E4, baso_washless$HM_E5, baso_washless$HM_E6))#
#
# define factors#
groupf <- tmp$group#
stimf <- tmp$stim#
# summarize#
agg <- by(tmp$CD63, list(stimf, groupf), fivenum)#
#
# plot figure 1A#
quartz(,10,5)#
boxplot(agg, ylab="%CD63", cex.lab=1.4, names=array(c("E1", "E2", "E3", "E4", "E5", "E6"),24), outline=FALSE); abline(v=c(6.5, 12.5, 18.5), lty=3)#
mtext("Allergic", 3, line=1, at=3.5)#
mtext("Control", 3, line=1, at=9.5)#
mtext("HM tolerant", 3, line=1, at=15.5)#
mtext("Outgrown", 3, line=1, at=21.5)#
mtext("A", cex=4, at=-1)
boxplot(agg, ylab="%CD63", cex.lab=1.4, names=array(c("E1", "E2", "E3", "E4", "E5", "E6"),24), outline=FALSE, notch=TRUE); abline(v=c(6.5, 12.5, 18.5), lty=3)
# plot figure 1A#
quartz(,10,5)#
boxplot(agg, ylab="%CD63", cex.lab=1.4, names=array(c("E1", "E2", "E3", "E4", "E5", "E6"),24), outline=FALSE); abline(v=c(6.5, 12.5, 18.5), lty=3)#
mtext("Allergic", 3, line=1, at=3.5)#
mtext("Control", 3, line=1, at=9.5)#
mtext("HM tolerant", 3, line=1, at=15.5)#
mtext("Outgrown", 3, line=1, at=21.5)#
mtext("A", cex=4, at=-1)
qqnorm(x)
qqnorm(tree[5])
tree[5]
qqnorm(tree[5])
qqnorm(as.numeric(tree[5]))
plot(tree[5:10])
qqnorm(tree$LFNCC)
qqline(tree$LFNCC)
qqnorm(x)
qqline(x)
tab1=data.frame(Vx=c(10,8,13,9,11,14,6,4,12,7,5), Vx=c(8.04,6.95,7.58,8.81,8.33,9.96,7.24,4.26,10.84,4.82,5.68))
tab1
tab2=data.frame(Vx=c(10,8,13,9,11,14,6,4,12,7,5), Vx=c(9.14,8.14,8.74,8.77,9.26,8.1,6.13,3.1,9.13,7.26,4.74))
tab2
tab3=data.frame(Vx=c(10,8,13,9,11,14,6,4,12,7,5), Vx=c(7.46,6.77,12.74,7.11,7.81,8.84,6.08,5.39,8.15,6.42,5.73))
tab3
tab4=data.frame(Vx=c(8,8,8,8,8,8,8,19,8,8,8), Vx=c(6.58,5.76,7.71,8.84,8.47,7.04,5.25,12.5,5.56,7.91,6.89))
tab4
mean(tab3)
mean(tab1);mean(tab2);mean(tab3);mean(tab4)
quartz();layout(mat(c(1:4),2,2))
quartz();layout(matrix(c(1:4),2,2))
plot(tab1)
plot(tab2); plot(tab3); plot(tab4)
quartz();layout(matrix(c(1:4),2,2))#
plot(tab1,pch=22);plot(tab2,pch=22);plot(tab3,pch=22);plot(tab4,pch=22)
19quartz();layout(matrix(c(1:4),2,2))#
plot(tab1,pch=19);plot(tab2,pch=22);plot(tab3,pch=22);plot(tab4,pch=22)
quartz();layout(matrix(c(1:4),2,2))#
plot(tab1,pch=19);plot(tab2,pch=22);plot(tab3,pch=22);plot(tab4,pch=22)
#
quartz();layout(matrix(c(1:4),2,2))#
plot(tab1,pch=19);plot(tab2,pch=19);plot(tab3,pch=19);plot(tab4,pch=19)
